Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Print a message on server timeout #6209

Closed
wants to merge 1 commit into from

Conversation

mmitalidis
Copy link

This is related to: #3851
When Bazel tries to download a file from a repository, but the Server does not respond then Bazel does not print an informative message, as it does for other network failures.

More specifically, a SocketTimeoutException is thrown from HttpConnector (https://github.com/bazelbuild/bazel/blob/master/src/main/java/com/google/devtools/build/lib/bazel/repository/downloader/HttpConnector.java)
The reason that no message is print is that exception caught is an InterruptedIOException (https://github.com/bazelbuild/bazel/blob/master/src/main/java/com/google/devtools/build/lib/bazel/repository/downloader/HttpDownloader.java#L229),
that is a super-class of SocketTimeoutException.

Fixing that by catching a SocketTimeoutException first.

When a remote server does not respond at all, a SocketTimeoutException
is thrown which is mistakenly interpreted as an InterruptedIOException.
Thus not printing an error message. This commit fixes it.
see: bazelbuild#3851
@iirina iirina added the team-ExternalDeps External dependency handling, remote repositiories, WORKSPACE file. label Sep 25, 2018
@iirina iirina requested a review from dslomov September 25, 2018 13:32
url = "http://127.0.0.1:$fileserver_port/some_archive.zip",
)
EOF
bazel build @repo//... &> $TEST_log 2>&1 && fail "Expected to fail"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How long does it wait for a timeout? I'm wondering how bad the effect on our CI is going to be...

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test takes ~3 mins.

I did time bazel build @repo//... &> $TEST_log 2>&1 && fail "Expected to fail"
in line 938 and got:

** test_server_timeout *********************************************************

real    2m56.609s
user    0m0.020s
sys     0m0.016s
PASSED: test_server_timeout

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that's a problem. Having a test wait for 3 minutes doing nothing means our CI will take 3 minutes longer. Is there any way to change the timeout with a flag or something like that?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any way to change the timeout with a flag or something like that?

Not at the moment. All the timeouts are hard-coded. But adding a flag to configure those timeouts seems a good idea in general; will work on this.

@ulfjack ulfjack requested review from aehlig and removed request for dslomov October 11, 2018 14:30
@jin jin assigned aehlig and dslomov and unassigned aehlig Dec 10, 2018
@bazel-io bazel-io closed this in 982e0b8 Apr 26, 2019
@philwo philwo added the team-OSS Issues for the Bazel OSS team: installation, release processBazel packaging, website label Jun 15, 2020
@philwo philwo removed the team-OSS Issues for the Bazel OSS team: installation, release processBazel packaging, website label Nov 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes team-ExternalDeps External dependency handling, remote repositiories, WORKSPACE file.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants